Skip to content

Conversation

@hamzahrmalik
Copy link
Contributor

Users should be able to use swift-configuration to create the http client configuration object

Changes

  • duplicate package.swift to create a separate version for 6.0 and 6.1, since Configuration is 6.2+
  • add helper to create http client configuration using ConfigReader

public init(configReader: ConfigReader) throws {
self.init()

// Each entry in the list should be a colon separated pair e.g. localhost:127.0.0.1 or localhost:::1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not comma-separated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colon felt more natural to me for defining key-value pairs. I don't mind though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma would probably make the ipv6 case slightly eaiser to parse too

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, comma might be used for splitting the pairs themselves e.g. in env vars. Hmm then comma isn't great, but colon is a bit confusing.

@czechboy0
Copy link

lgtm, I'll let the maintainers actually approve though 🙂

Comment on lines +9 to +14
/// - `dnsOverrides` (string array, optional): Colon-separated host:IP pairs for DNS overrides (e.g., "localhost:127.0.0.1").
/// - `redirect` (scoped): Redirect handling configuration read by ``RedirectConfiguration/init(configReader:)``.
/// - `timeout` (scoped): Timeout configuration read by ``Timeout/init(configReader:)``.
/// - `connectionPool` (scoped): Connection pool configuration read by ``ConnectionPool/init(configReader:)``.
/// - `httpVersion` (string, optional, default: automatic): HTTP version to use ( "automatic" or "http1Only").
/// - `maximumUsesPerConnection` (int, optional, default: nil, no limit): Maximum uses per connection.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used dots for hierarchy but camel case for words

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dns.overrides and http.version make sense in that system. But maximum.uses.per.connection does not

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be connection.limits.maximum.uses. It is not the end of the world but it would be great if we could be a bit consistent around the ecosystem. @czechboy0 WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah i like that idea

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been doing the same as Hamzah - use dots for separating components, with individual components being camelCase. So http.maxConnectionCount, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants